﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BUS;

namespace TuyenDungViecLam.User_control_VN
{
    public partial class Menu_Header : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                rploaihinhcongviec.DataSource = ChiTietCongViec_BUS.DanhSachCacLoaiHinhCongViec();
                rploaihinhcongviec.DataBind();
            }
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (Session["Role"].ToString() == "" || Session["Role"].ToString() == "NguoiTimViec")
            {
                rploaihinhcongviec.DataSource = ChiTietCongViec_BUS.DanhSachCacLoaiHinhCongViec();
                rploaihinhcongviec.DataBind();
                MenuEmployee.Visible = true;
                MenuAdmin.Visible = false;
                MenuEmployer.Visible = false;
                if (Session["Role"].ToString() == "NguoiTimViec")
                {
                    lbEmployee.ForeColor = System.Drawing.Color.Red;
                }

            }

            if (Session["Role"].ToString() == "NhaTuyenDung")
            {
                rploaihinhcongviec2.DataSource = ChiTietCongViec_BUS.DanhSachCacLoaiHinhCongViec();
                rploaihinhcongviec2.DataBind();
                MenuEmployee.Visible = false;
                MenuAdmin.Visible = false;
                MenuEmployer.Visible = true;
            }
            if (Session["Role"].ToString() == "Administrator")
            {
                rploaihinhcongviec3.DataSource = ChiTietCongViec_BUS.DanhSachCacLoaiHinhCongViec();
                rploaihinhcongviec3.DataBind();
                MenuEmployee.Visible = false;
                MenuAdmin.Visible = true;
                MenuEmployer.Visible = false;
            }

        }

    }
}